import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    Components({
      resolvers: [NaiveUiResolver()]
    })
  ],
  server: {
    host: '0.0.0.0',//ip
    port: 8082,//端口
    https: false,// 是否开启 https
    open:true,//自动打开游览器
    hmr:true,//是否热更新
  },
  // 设置反向代理，跨域
  proxy: {
    // '/api1': {
    //   // 后台地址
    //   target: 'http://127.0.0.1:8990/',
    //   changeOrigin: true,
    //   rewrite: path => path.replace(/^/api1/, '')
    // },
    // '/api2': {
    //   // 后台地址
    //   target: 'http://127.0.0.1:8956/',
    //   changeOrigin: true,
    //   rewrite: path => path.replace(/^/api2/, '')
    // }
  }
})